﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LOL_Mastery_Tool
{
    using System.Collections;
    using System.Drawing;

    class Mastery
    {
        private string mName;
        private string mLevelData;
        private ArrayList mConditions;
        private int[] mConditionNum;
        private double[,] mReplace;
        private int mMaxLevel;
        private int mLevel;
        private int mRow;
        private int mWidth;
        private int mHeight;
        private Rectangle mRect;

        /// <summary>
        /// Initializes a new instance of the <see cref="Mastery"/> class.
        /// </summary>
        /// <param name="name">
        /// The Mastery Name.
        /// </param>
        /// <param name="rectPosition">
        /// The rectangle position, treePoint(column, row, tree)
        /// </param>
        /// <param name="maxLevel">
        /// The max level.
        /// </param>
        /// <param name="levelData">
        /// The description in formatted string, %f (float for numeric descriptors)
        /// </param>
        /// <param name="Replace">
        /// The replacing values for %f in formatted string, eg: new double[,]{ {0.17, 0.33, 0.5}, {3, 3, 9, 12} } or null
        /// </param>
        /// <param name="masteries">
        /// The masteries prerequisites, offensePoints  or new Mastery[] { mOffense, mDeadliness }
        /// </param>
        /// <param name="levels">
        /// The levels of points that must be used in each prerequisite, new int[] { 4 } or new int[] { 8, 4 }
        /// </param>
        /// <param name="row">
        /// The row of the mastery (0 based)
        /// </param>
        /// <param name="width">
        /// The width of the tooltip
        /// </param>
        /// <param name="height">
        /// The height of the tooltip
        /// </param>
        public Mastery(string name, Point rectPosition, int maxLevel, string levelData, double[,] Replace, Mastery[] masteries, int[] levels, int row, int width, int height)
        {
            mName = name;
            mRect = new Rectangle(rectPosition.X, rectPosition.Y, 48, 48);
            mMaxLevel = maxLevel;
            mLevelData = levelData;
            mLevel = 0;
            mConditions = new ArrayList();
            mReplace = Replace;
            mConditionNum = levels;
            mRow = row;
            mWidth = width;
            mHeight = height;
            if (masteries != null) foreach (Mastery m in masteries) { mConditions.Add(m); }
        }

        // Special set up for a 'tree' mastery
        public Mastery(string name)
        {
            mName = name;
            mRect = new Rectangle();
            mMaxLevel = 30;
            mLevelData = "";
            mLevel = 0;
            mConditions = new ArrayList();
            mReplace = new double[0, 0];
        }

        public string Name { get { return mName; } }
        public Rectangle Rectangle { get { return mRect; } }
        public ArrayList Conditions { get { return mConditions; } }
        public int[] ConditionLevels { get { return mConditionNum; } }
        public int MaxLevel { get { return mMaxLevel; } }
        public int Height { get { return mHeight; } }
        public int Width { get { return mWidth; } }
        public int Row { get { return mRow; } }
        public int Level { get { return mLevel; } set { mLevel = value; } }
        public string LevelData { get { return mLevelData; } }
        public double[,] DataReplace { get { return mReplace; } }
    }
}
